   function submitForm(action) {
	   //alert('submitForm - 1');
      if(action == null || action.length == 0) {
    	  //alert('submitForm - 2');
         document.forms[0].submit();
      }
      else {
    	  //alert('submitForm - 3');
         oForm = eval("document." + getFormName());
         oForm.action = '/poc' + action;
         //alert(oForm.action);
         oForm.method = 'POST';
         oForm.submit();
      }
      return;
   }

   function getFormName() {
      return document.forms[0].name;
   }

	function checkAnswer123(url) {
		var useranswer;
		try {
			useranswer = eval('document.' + getFormName() + '.useranswer').value;
		}
		catch(e) {
			alert('............Error!');
		}
	    var processedurl = '/poc' + url + '&useranswer=' + useranswer;
	    retrieveURL(processedurl, 'answercheckblock');
	} 

   function processEnter(e, url) {
       if(e && e.keyCode == 13) {
    	   checkAnswer(url);
       }
    }
   
   function processLogin(e, url) {
       if(e && e.keyCode == 13) {
    	   submitForm(url);
       }
    }

   //This function checks the radio button selected 
	function getCheckedRadio(radiobtnname) {
		var selectedval = "";
        var radioButtons = document.getElementsByName(radiobtnname);
        for (var x = 0; x < radioButtons.length; x ++) {
          if (radioButtons[x].checked) {
          selectedval = radioButtons[x].value;
            //alert("You checked " + radioButtons[x].id + " which has the value " + radioButtons[x].value);
          }
        }
        return selectedval;
	}

	function getComboSelected(fieldname) {
	
		//var oForm = eval('document.' + getFormName());
		//alert(fieldname);
		var selectedval = document.getElementsByName(fieldname);
		//alert('Selected Index: ' + oField.selectedIndex);
		
		var oField = eval('document.' + getFormName() + '.' + fieldname);
		//alert(oField);
		var len = oField.length;
		//alert(len);
		//alert('Form Name: ' + getFormName());
		var i = 0;
		var chosen = "none";
		
		for (i = 0; i < len; i++) {
		   var obj = eval('document.' + getFormName() + '.' + fieldname + '[' + i + ']');
			if (obj.selected) {
				chosen = obj.value;
			} 
		}
		//alert('Chosen Value: ' + chosen);
		return chosen;
	
		
	}
   
   function checkForElement(formName,elementType){
      var elemSize = eval('document.' + getFormName() + '.elements.length');
      var isThere = 0;
      var i;var el;
      for (i=0;i<elemSize;i++) {
         el = eval('document.' + getFormName() + '.elements[i]');
         if(el.type  == elementType) {
            return true;
         }
      }
      return false;
   }
   
   function getCurrentBrowserName() {
	   var browserName = "";

	   var ua = navigator.userAgent.toLowerCase();
	   if ( ua.indexOf( "opera" ) != -1 ) {
		   browserName = "opera";
	   } 
	   else if ( ua.indexOf( "msie" ) != -1 ) {
		   browserName = "msie";
	   } 
	   else if ( ua.indexOf( "safari" ) != -1 ) {
		   browserName = "safari";
	   } 
	   else if ( ua.indexOf( "mozilla" ) != -1 ) {
		   if ( ua.indexOf( "firefox" ) != -1 ) {
			   	browserName = "firefox";
	       } 	
	       else {
	    	   browserName = "mozilla";
	       }
	   }
	   else {
		   browserName = "";
	   }

	   return browserName;
   }
   
   function tellmemybrowser() {
	   alert(navigator.appName);
   } 
   
   function getOperatingSystem() {
	   var OSName = navigator.appVersion;
	   
	   if (navigator.appVersion.indexOf("Win")!=-1) {
		   OSName="Windows";
	   }
	   else if (navigator.appVersion.indexOf("Mac")!=-1) {
		   OSName="MacOS";
	   }
	   else if (navigator.appVersion.indexOf("X11")!=-1) {
		   OSName="UNIX";
	   }
	   else if (navigator.appVersion.indexOf("Linux")!=-1) {
		   OSName="Linux";
	   }
	   
	   return OSName;
	   
   }
   
   function trimSpaces(strText) {
      //This will get rid of leading spaces
      while(strText.substring(0,1) == ' ')
      	strText = strText.substring(1, strText.length);
      //This will get rid of trailing spaces	
      while(strText.substring(strText.length-1, strText.length) == ' ')
      	strText = strText.substring(0, strText.length-1);
      return strText;		
   }
   
   function isEmpty(str) {
	    //alert('Checks for isEmpty method');
		//alert(' For null value: isEmpty returns: ' + isEmpty(null)); //returns true
		//alert(' For NOT null value: isEmpty returns: ' + isEmpty('hello'));	//returns false
		//alert(' For empty (just two quotes) value: isEmpty returns: ' + isEmpty(''));	//returns true
		//alert(' For empty (just space) value: isEmpty returns: ' + isEmpty(' '));	//returns false
	    
	    return (!str || 0 === str.length);
   }

   function isBlank(str) {
		//alert('Checks for isBlank method');
		//alert(' For null value: isBlank returns: ' + isBlank(null)); //returns true
		//alert(' For NOT null value: isBlank returns: ' + isBlank('hello'));	//returns false
		//alert(' For empty (just two quotes) value: isBlank returns: ' + isBlank(''));	//returns true
		//alert(' For empty (just space) value: isBlank returns: ' + isBlank(' '));	//returns true
	    
	    return (!str || /^\s*$/.test(str));
   }
 

   function isElementExists(elementName){
      //var elemSize = eval('document.' + formName + '.elements.length');
      var elemSize = eval('document.' + getFormName() + '.elements.length');
      var i;var el;
      for (i=0;i<elemSize;i++) {
         //el = eval('document.' + formName + '.elements[i]');
         el = eval('document.' + getFormName() + '.elements[i]');
         //alert(el.name);
	      if(el.name == elementName) {
	            return true;
	      }
      }
      return false;
   } 


   
